/**
 * @不用数组产生Fibonacci数
 *
 * @author	 wangshikun <wangshikun2010@gmail.com>
 * @copyright	(c) 2012 wangshikun <wangshikun2010@gmail.com>
 * @license	http://www.opensource.org/licenses/mit-license.php The MIT License
 * @package	default
 * @subpackage	default
 */

#include <stdio.h>
#include <cs50.h>

int main(int argc, char *argv[]) {
	unsigned int i;
	unsigned long i1 = 0;
	unsigned long i2 = 1;
	unsigned int number;
	unsigned long temp;

	printf("请输入要累加数的范围：");
	scanf("%d", &number);

	if (number <0 || number > 75) {
		printf("你输入的数字超出了范围！\n");
		return 1;
	}

	for (i=1; i<=number; i++) {
		if (i == 1) {
			printf("%ld ", i1);
		} else if (i == 2) {
			printf("%ld ", i2);
		} else {
			temp = i1 + i2;
			i1 = i2;
			i2 = temp;
			printf("%ld ", temp);
		}
	}

	printf("\n");

	return 0;
}
